package ynu.edu.ky_elm_springboot3.mapper;

import ynu.edu.ky_elm_springboot3.po.Orders;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface OrdersMapper {
    
    @Insert("insert into orders(userId,businessId,orderDate,orderTotal,daId,orderState) values(#{userId},#{businessId},#{orderDate},#{orderTotal},#{daId},0)")
    @Options(useGeneratedKeys = true, keyProperty = "orderId")
    int saveOrders(Orders orders);
    
    Orders getOrdersById(Integer orderId);
    
    @Select("select * from orders where userId=#{userId} order by orderId desc")
    List<Orders> listOrdersByUserId(String userId);
} 